headerbar: don't throw a warning if title widget is hidden
authorRay Strode <rstrode@redhat.com>
Wed, 29 Jun 2016 13:20:55 +0000 (09:20 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 29 Jun 2016 13:27:33 +0000 (09:27 -0400)
commit 0015ebc4a8f269f6888fcacef3e83e3167241d67 reworked
some of the titlebar size allocation code.  Those changes
inadvertently introduced a warning when the application sets
the headerbar title widget to be hidden.

This commit fixes that warning.

https://bugzilla.gnome.org/show_bug.cgi?id=768184

gtk/gtkheaderbar.c

index 47fb70c22dd51a5b23bd596dd39119277ea80c3e..8182bec972dfe5d9ce326a07f98ba04239aa59ed 100644 (file)
@@ -997,7 +997,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   gint nvis_children;
   gint title_minimum_size;
   gint title_natural_size;
-  gboolean title_expands;
+  gboolean title_expands = FALSE;
   gint start_width, end_width;
   gint uniform_expand_bonus[2] = { 0 };
   gint leftover_expand_bonus[2] = { 0 };
@@ -1051,13 +1051,15 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
     title_widget = NULL;
 
   if (title_widget)
-    gtk_widget_get_preferred_width_for_height (title_widget,
-                                               height,
-                                               &title_minimum_size,
-                                               &title_natural_size);
-  width -= title_natural_size;
+    {
+      gtk_widget_get_preferred_width_for_height (title_widget,
+                                                 height,
+                                                 &title_minimum_size,
+                                                 &title_natural_size);
+      width -= title_natural_size;
 
-  title_expands = gtk_widget_compute_expand (title_widget, GTK_ORIENTATION_HORIZONTAL);
+      title_expands = gtk_widget_compute_expand (title_widget, GTK_ORIENTATION_HORIZONTAL);
+    }
 
   start_width = 0;
   if (priv->titlebar_start_box != NULL)